# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Contributor: Francisco Lopes

pkgname=interception-tools
pkgver=0.6.8
pkgrel=6
pkgdesc='A minimal composable infrastructure on top of libudev and libevdev'
arch=('loong64' 'x86_64')
license=('GPL3')
url='https://gitlab.com/interception/linux/tools'
depends=(
    'libevdev' 'libevdev.so'
    'yaml-cpp' 'libyaml-cpp.so'
    'systemd-libs' 'libudev.so'
)
makedepends=('cmake' 'systemd' 'boost')
source=(
    "$pkgname-$pkgver.tar.gz::https://gitlab.com/interception/linux/tools/-/archive/v$pkgver/tools-v$pkgver.tar.gz"
)
sha256sums=('84ced1c10bef7f00660704685c651c4241096cc9848c31f5a04f166e1450949d')

build() {
    cmake -B build \
          -S "tools-v${pkgver}" \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DCMAKE_BUILD_TYPE=None \
          -Wno-dev
    cmake --build build
}

package() {
    install -dm755 "$pkgdir/etc/interception/udevmon.d"
    install -Dm644 "tools-v$pkgver/udevmon.service" -t "$pkgdir/usr/lib/systemd/system"
    install -Dm644 "tools-v$pkgver/README.md" -t "$pkgdir/usr/share/doc/$pkgname"

    cd build
    make DESTDIR="$pkgdir/" install
}
